package cn.testtoolbar.com.testtoolbar;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.ImageView;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    private AppBarLayout mAppBar;
    private CollapsingToolbarLayout mCollapsingToolbar;
    private ImageView mFruitImageView;
    private Toolbar mToolbar;
    private TextView mToolbarTv1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
    }

    @SuppressLint("RestrictedApi")
    private void initView() {
        mAppBar = (AppBarLayout) findViewById(R.id.appBar);
        mCollapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
        mFruitImageView = (ImageView) findViewById(R.id.fruit_image_view);
        mToolbar = (Toolbar) findViewById(R.id.toolbar);
        mToolbarTv1 = (TextView) findViewById(R.id.toolbar_tv1);
        TextView contentTv = (TextView) findViewById(R.id.test_content_tv);
        String datas = getData(100);
        contentTv.setText(datas);
    }

    private String getData(int size) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < size; i++) {
            sb.append("测试内容\n" + i);
        }
        return sb.toString();
    }
}
